<ui:composition
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>
	<f:loadBundle basename="bundle.address" var="addressBundle"/>
	<f:loadBundle basename="bundle.person" var="personBundle"/>
	<h:panelGrid id="#{idPrefix}AddrEditPanel" columns="2" width="380px">
		<h:outputText value="#{personBundle.addressType}" styleClass="requiredField" rendered="#{addrType}"/>
		<itdep:entitySelectMenu value="#{address.addressType}" entityType="address-type" format="{i18n.fullName}"
								anyValue="true" filter="#{addressTypePersonBean.filter}" rendered="#{!addrType}"
								styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.country}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{actionBean.filter.country}"
								entityType="country"
								format="{name}"
								id="#{idPrefix}Country"
								anyValue="true" disabled="#{empty address.addressType and addrType}"
								styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.region}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{actionBean.filter.region}"
								filter="#{actionBean.filter}"
								entityType="region"
								format="{name}"
								anyValue="true" disabled="#{empty actionBean.filter.country}"
								styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.district}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{actionBean.filter.district}" entityType="district" format="{name}"
								filter="#{actionBean.filter}" anyValue="true"
								disabled="#{empty actionBean.filter.region}" styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.settlement}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{actionBean.filter.settlement}" entityType="settlement" format="{name}"
								filter="#{actionBean.filter}" disabled="#{empty actionBean.filter.district}"
								anyValue="true" styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.city}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{actionBean.filter.city}" entityType="city" format="{name}"
								filter="#{actionBean.filter}" disabled="#{empty actionBean.filter.district}"
								anyValue="true" styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.street}" styleClass="requiredField"/>
		<itdep:entitySelectMenu value="#{address.street}" entityType="street" format="{name}"
								filter="#{actionBean.filter}" disabled="#{empty actionBean.filter.city}"
								anyValue="true" styleClass="sizeCopmonent">
			<a4j:support event="onchange" reRender="#{idPrefix}AddrEditPanel" ajaxSingle="true"/>
		</itdep:entitySelectMenu>

		<h:outputText value="#{addressBundle.buildingNumber}" styleClass="requiredField"/>
		<h:panelGroup>
			<h:inputText id="#{idPrefix}BuildingNumber" value="#{address.buildingNumber}"
						 disabled="#{empty address.street}" required="true" styleClass="sizeCopmonent" maxlength="20"/>
			<itdep:errorMessage for="#{idPrefix}BuildingNumber"/>
		</h:panelGroup>

		<h:outputText value="#{addressBundle.houseNumber}"/>
		<h:inputText value="#{address.houseNumber}" disabled="#{empty address.street}" styleClass="sizeCopmonent"
					 maxlength="20"/>

		<h:outputText value="#{addressBundle.flatNumber}"/>
		<h:inputText value="#{address.flatNumber}" disabled="#{empty address.street}" styleClass="sizeCopmonent"
					 maxlength="20"/>

		<h:outputText value="#{addressBundle.zipCode}"/>
		<h:inputText value="#{address.zipCode}" disabled="#{empty address.street}" styleClass="sizeCopmonent"
					 maxlength="50"/>
	</h:panelGrid>

	<h:panelGroup>
		<ui:insert name="AccomodationType"/>
	</h:panelGroup>


</ui:composition>
